﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using WebApiClient.Attributes;
using WebApiClient.Parameterables;
using WebApiClient;

namespace Rest.WebApiClient.Contracts
{
    [TraceFilter(OutputTarget = OutputTarget.Console | OutputTarget.Debug)]
    [HttpHost("https://localhost:44309/")] // HttpHost可以在Config传入覆盖
    public interface IUserApi : IHttpApi
    {

        [HttpGet("WeatherForecast/GetUserInfo")]
        [Timeout(10 * 1000)] // 10s超时
        Task<string> GetUserAPI(string userName);

        [HttpGet, HttpPost]
        [Timeout(10 * 1000)] // 10s超时
        Task<string> GetUserAPIV2([Url] string url, string userName);

        [HttpGet("WeatherForecast/GetUserInfo")]
        ITask<string> GetAsync(string userName);

        [HttpGet("api/user")]
        ITask<string> GetAboutAsync([Uri] string url, string value);
    }

    //public class UserApi : IUserApi
    //{
    //    public void Dispose()
    //    {

    //    }

    //    public Task<string> GetAboutAsync([Uri] string url, string value)
    //    {
    //        return Task.Run(() => url + value);
    //    }
    //}
}
